package com.example.shardingsphere.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 用于测试 水平分库，水平分表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_order")  // 映射到数据库中的表名
public class Order {

    @TableId(value = "order_id", type = IdType.ASSIGN_ID)  // 主键策略
    private Long orderId;

    @TableField("user_id")
    private Long userId;

    @TableField("product_id")
    private Long productId;

    @TableField("quantity")
    private Integer quantity;

    @TableField("unit_price")
    private BigDecimal unitPrice;

    @TableField("total_price")
    private BigDecimal totalPrice;

    @TableField("order_date")
    private LocalDateTime orderDate;

    @TableField("status")
    private String status;  // 使用字符串类型表示 ENUM

}